package Work0602;

import java.util.*;

public class Vip implements Comparable<Vip> {
	private String name;// 姓名
	private int cardNumber;// 卡号
	private String password;// 密码
	private int integral;// 积分
	private Date day;// 开卡日期

	public Vip(String name, int cardNumber, String password, int integral, Date day) {
		this.name = name;
		this.cardNumber = cardNumber;
		this.password = password;
		this.integral = integral;
		this.day = day;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getCardNumber() {
		return cardNumber;
	}

	public void setCardNumber(int cardNumber) {
		this.cardNumber = cardNumber;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getIntegral() {
		return integral;
	}

	public void setIntegral(int integral) {
		this.integral = integral;
	}

	public Date getDay() {
		return day;
	}

	public void setDay(Date day) {
		this.day = day;
	}

	@Override
	public int compareTo(Vip o) {

		return this.cardNumber - o.cardNumber;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + cardNumber;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Vip other = (Vip) obj;
		if (cardNumber != other.cardNumber)
			return false;
		return true;
	}

}
